package com.fairytask.ui
{
	import com.fairytask.engine.GameStage;
	import com.fairytask.engine.components.clip.Clip;
	import com.fairytask.engine.components.text.Label;
	import com.fairytask.engine.define.ResConfig;
	import com.fairytask.managers.ViewManage;
	import com.fairytask.resource.StaticIni;
	import com.fairytask.ui.base.FrameUI;
	
	import flash.events.Event;
	
	/**
	 * 玩家等级信息框,阶段目标
	 * @author pangj
	 * 
	 */
	public class LevelUpInfoUI extends FrameUI
	{
		private static var _self:LevelUpInfoUI;
		public var describe  :Label;//描述文字
		public var icon      :Clip; //图标
		public var isShowUI  :Boolean=false;//是否显示
		
		public static function getInstance():LevelUpInfoUI
		{
			if(_self==null)
			{
				_self=new LevelUpInfoUI();
			}
			return _self;
		}
		public function LevelUpInfoUI(popUI:Boolean=false)
		{
			super(popUI);
		}
		override public function show(space:String=BACKLAYER, onshow:Function=null):void
		{
			if(isShowUI)
				super.show(space,onshow);
			ViewManage.maskEnable	=	false;
		}
		override public function hide(e:*=null):void
		{
			isShowUI = false;
			super.hide(e);
		}
		
		/**
		 * 设置等级提示内容
		 * val:当前等级
		 */
		public function set showLvInfo(val:String):void
		{
			describe.htmlStrByBorder = StaticIni.getSwfLangStrVar("LvUpEvent",
				[StaticIni.getIniVar("LvEvent_"+val,"LV"),
				 StaticIni.getSwfLangStr(StaticIni.getIniVar("LvEvent_"+val,"String"))]
			);
			icon.source = ResConfig.iconPath+StaticIni.getIniVar("LvEvent_"+val,"Icon")+ResConfig.iconImg;
			isShowUI = true;
			show();
		}
		/**
		 * 设置图标
		 * 
		 */
		public function set Icon(val:String):void
		{
			icon.source = ResConfig.iconPath+val+ResConfig.iconImg;
		}
		
		/**
		 * 场景变化改变位置 
		 * 
		 */
		override protected function stageReSize(evt:Event=null):void
		{
			this.x =	initX - GameStage.mainLayer.x;
			this.y = 	initY - GameStage.mainLayer.y;
		}
	}
}